<%@page import="com.moment.model.UserReg"%>
<%@page import="com.moment.webservice.*"%>
<%@page import="com.moment.util.Converter"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@page import="java.util.*"%>




<%
UserReg userobj = (UserReg) session.getAttribute("userObj");
	Random randomValue = new Random();
	// --New CODE-------------
	Map<String, String> map = new HashMap<String, String>();
	map.put("method", "13");
	map.put("mnum", (String) session.getAttribute("username"));

	String json = new Converter().mapToJson(map);
	System.out.println("json String :" + json);
	Services serviceproxy = new ServicesProxy();

	String notify = serviceproxy.service(json);
	// ---------------------------
	/* WebsProxy ws = new WebsProxy();
	String notify = ws.getNotification(userobj.getMob()); */
	String memtype = userobj.getTypeofmember();
	System.out.println("notify "+notify);
	if(!notify.equals("Fail"))
	{
	String[] notify_array = notify.split("[$]");
	for (String s : notify_array) {

		//out.print(s + "<br/>");

		String[] curr_notify = s.split("[-]");
		out.print("<div class='login2inner'>");
		out.print("Number : " + curr_notify[0] + "<br/>");
		out.print("Amount : " + curr_notify[1] + " USD" );
		out.print("<br/>");
		if(memtype.equalsIgnoreCase("merchant"))
		{
			String color = "green";
			Map<String,String> colorMap=new HashMap<String,String>();
			colorMap.put("done", "green");
			colorMap.put("reject", "red");
			colorMap.put("pending", "blue");
			if(curr_notify[2].equalsIgnoreCase("reject"))
			{
				color = "red";
			}
			else if(curr_notify[2].equalsIgnoreCase("pending"))
			{
				color = "blue";
			}
			out.print("<span style='color:"+colorMap.get(curr_notify[2].toLowerCase())+"'>Status : "+ curr_notify[2] +"</span>");
		}else
		{
			out.print("<a href='#' class='btninstru' id='accept' name='accept' onclick=accept('"
					+ curr_notify[0] + "','"
					+ curr_notify[1] + "','"
					+ curr_notify[3] + "');>Accept</a>&nbsp;&nbsp;&nbsp;");
					out.print("<a href='#'  class='btninstru' id='reject' name='reject' onclick=reject('"
					+ curr_notify[3] + "');>Reject</a>");
		}
		
		out.print("<br/></div>");
	}
	}
	else
	{
		out.print("No payment request(s)");
	}
%>
